home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
441
/
dlibs12
/
rand.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-23
|
488b
|
27 lines
#include <osbind.h>
#include <stdio.h>
rand()
{
return((Random() >> 3) & RAND_MAX);
}
/*
* In environments where the operating system doesn't provide
* a random number generator, the following code may be useful.
*
* static unsigned long _seed = 1;
*
* int rand()
* {
* _seed = (_seed * 1103515245) + 12345;
* return((unsigned int) ((next / 65536) % 32768));
* }
*
* void srand(seed)
* unsigned int seed;
* {
* _seed = seed;
* }
*/